package service.applycheck.impl;

import java.util.List;

import dao.ApplyopinionDao;
import exception.Exceptions;

import model.creditcheck.Applyopinion;
import service.applycheck.ApplyOpinionService;

public class ApplyOpinionServiceImpl implements ApplyOpinionService{
	private ApplyopinionDao applyopinionDao;
	
	@Override
	public Applyopinion save(Applyopinion applyopinion) throws Exceptions {
		try {
			return this.applyopinionDao.save(applyopinion);
		} catch (Exception e) {
			throw new Exceptions("在插入的过程中出现了一个错误，请检查你插入的信息是否符合标准");
		}
	}

	@Override
	public List<?> getListAllByApplyId(Integer applyid) throws Exceptions{
		String select = "new vo.RecoredBean(a.checktype, a.opinion, a.result, u.useraccount, a.docpath, a.dodate)";
		String from = "Applyopinion as a, UsrUser as u where a.applyid = " + applyid + " and a.managerid = userid";
		return this.applyopinionDao.findQuery(select, from);
	}

	public ApplyopinionDao getApplyopinionDao() {
		return applyopinionDao;
	}

	public void setApplyopinionDao(ApplyopinionDao applyopinionDao) {
		this.applyopinionDao = applyopinionDao;
	}

}
